import {LogFactory} from "../log"
import {isController, isFilter, isReturnValueHandler} from "../util/internalTypeUtil"
import {HandlerManager} from "../../manager/HandlerManager"
import {FilterManager} from "../../manager/FilterManager"
import {ReturnValueHandlerManager} from "../../manager/ReturnValueHandlerManager"

const logger = LogFactory.getLogger("@Component")

export function Component(): ClassDecorator {
  return (Ctor) => {
    if (isController(Ctor)) {
      HandlerManager.resolveController(Ctor)
      return
    }
    if (isFilter(Ctor)) {
      FilterManager.resolveFilter(Ctor)
      return
    }
    if (isReturnValueHandler(Ctor)) {
      ReturnValueHandlerManager.resolveReturnValueHandler(Ctor)
      return
    }
  }
}
